package com.yongjie.springbootlogin.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.yongjie.springbootlogin.entity.Notice;
import com.yongjie.springbootlogin.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@Service
public class NoticeService {
    /*
     * 注入dao
     * */
    @Autowired
    private com.yongjie.springbootlogin.mapper.NoticeMapper noticemapper;

    //获取数据总条数
    public Integer selCount(){
        return noticemapper.selCount();
    }
    //获取分页数据
    public List<Notice> getUsersPages(int currentPage, int pageSize){
        return    noticemapper.getUsersPages(currentPage,pageSize);
    }

    //添加数据
    public int insNotice(String title,String content,String n_user,String classify,String nt_state){
        return noticemapper.insNotice(title,content,n_user,classify,nt_state);
    }

    //根据ID删除数据
    public Integer delnotice(Integer id){
        return noticemapper.delnotice(id);
    }

    //根据id查询数据
    public Notice finnoticeById(int id){
        return noticemapper.finnoticeById(id);
    }

}
